home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
comms
/
mlk104a.arj
/
HOST.MSL
< prev
next >
Wrap
Text File
|
1992-04-13
|
14KB
|
436 lines
' Host mode script
' Access levels are: 3 - Sysop
' 2 - user can access any directory
' 1 - user can access only current directory
PUSH
SET ECHO ON
SET TEXTWRAP ON
SET HOSTECHO ON
SET INCRLF ON
SET OUTCRLF ON
SET CARRIERDETECT ON
upload_dir$ = uploaddirectory
default_dir$ = defaultdirectory
file_spec$ = filespec
cr$ = "^M"
cr2$ = "^M^M"
cr3$ = "^M^M^M"
cr4$ = "^M^M^M^M"
cr5$ = "^M^M^M^M^M"
newpage$ = cr5$+cr5$+cr5$+cr5$+cr5$
Header$ = " Host Mode"
welcome1$ = " ***********************************"+cr$
welcome2$ = " * Microlink Host Mode *"+cr$
welcome3$ = " * Press ENTER to Continue *"+cr$
welcome4$ = " ***********************************"+cr5$
continue = 1
max_lines = 20
WHILE continue=1
if ChangeDirectory(default_dir$) > 0 then
mprint "Invalid default directory"
beep
sleep 5
continue = 0
GOTO force_hangup
endif
current_dir$ = default_dir$
ONERROR force_hangup
AUTOANSWER
' Computer answered phone
sleep 5
IF Connected = 0 Then
goto force_hangup
endif
RPRINT newpage$
RPRINT welcome1$
RPRINT welcome2$
RPRINT welcome3$
RINPUT welcome4$,temp$
Rprint cr4$
' Prompts to enter password
logon_ok = 0
set error off
FOR i = 1 TO 3
onerror skipsignon
RINPUT cr$+"Enter FIRST name: ", first$
RINPUT cr$+"Enter LAST name: ", last$
SET HOSTECHO OFF
RINPUT cr$+"Enter PASSWORD: ", password$
set error off
SET HOSTECHO ON
logon_ok = VerifyUser(first$, last$, password$)
IF logon_ok > 1 THEN
IF OPENHOST = 1 THEN
onerror skipnew
rprint cr2$+" N E W U S E R"+cr2$
Rprint cr$+"First Name: "+first$
Rprint cr$+"Last Name: "+last$
RINPUT cr$+"Correct? ", Temp$
logon_ok = 0
IF upper(Temp$) = "Y" THEN
IF Adduser(first$, last$, password$, 1) > 0 THEN
RPRINT cr2$+"Unable To Add User At This Time"
logon_ok = 1
ENDIF
EXIT
ENDIF
skipnew:
ELSE
RPRINT cr2$+"Invalid logon attempt!"
IF i < 3 THEN
RPRINT cr$+"There are " + String(3 - i) + " attempts left."
ENDIF
ENDIF
ELSE
IF logon_ok = 1 THEN
RPRINT cr$+"Invalid logon attempt!"
IF i < 3 THEN
RPRINT cr$+"There are " + String(3 - i) + " attempts left." + cr$
ENDIF
ELSE
EXIT
ENDIF
ENDIF
skipsignon:
NEXT
IF logon_ok > 0 THEN
RPRINT cr2$+"Unable to validate user!"
RPRINT cr2$+"Hanging up!"
goto force_hangup
else
continue_commands = 1
access_level = ExtractUserLevel(first$, last$)
rprint cr4$
endif
WHILE continue_commands = 1
if Connected = 0 then
EXIT
endif
RPRINT cr2$+" Host Mode Processor"+cr2$
RPRINT cr$ + "[F]File Directory [D]Download [U]Upload"
' Level 2 or 3
IF access_level > 1 THEN
RPRINT cr$ + "[CD]Change Directory [FS]File Specification"
ENDIF
' Level 3 only
IF access_level > 2 then
RPRINT cr$ + "[AU]Add User [CU]Change User"
RPRINT cr$ + "[DU]Delete User [S]ShutDown"
ENDIF
RPRINT cr$ + "[G]Goodbye"
' Wait for command
RINPUT cr2$+current_dir$ + "> ", tempcommand$
command$ = upper(tempcommand$)
' Exit System
if len(command$) = 1 then
IF command$ = "G" THEN
RPRINT cr$ + "Thanks for calling " + first$ + "!" + cr$
continue_commands = 0
SLEEP 2
ENDIF
' List Files
IF command$ = "F" THEN
RPRINT cr4$
RPRINT "Directory listing of: " + current_dir$ + cr2$
ChangeDirectory(current_dir$)
filename$ = GetFirstDirEntry(current_dir$, file_spec$)
WHILE Len(filename$) > 0
IF Connected = 0 Then
EXIT
endif
FOR i = 1 to max_lines
RPRINT filename$ + cr$
filename$ = GetNextDirEntry()
IF Len(filename$) = 0 THEN
EXIT
ENDIF
NEXT
IF LEN(filename$) > 0 THEN
Rinput cr$+"List paused. Press ENTER to continue.",temp$
IF "C" = upper(temp$) THEN
exit
ENDIF
rprint cr4$
ENDIF
WEND
RINPUT cr$+"End of List. Press ENTER to Continue",temp$
rprint cr4$
ENDIF
' Download a File
IF command$ = "D" THEN
rprint cr4$
WHILE 1 = 1
IF Connected = 0 Then
EXIT
endif
RPRINT cr$+Header$+cr3$
RPRINT cr$+"Available download file transfer protocols:" + cr2$
RPRINT "[X]..XMODEM Checksum" + cr$
RPRINT "[C]..XMODEM CRC" + cr$
RPRINT "[Y]..YMODEM 1K" + cr$
RPRINT "[YB].YMODEM Batch" + cr$
RPRINT "[YG].YMODEM G" + cr$
RPRINT "[Z]..ZMODEM" + cr$
RPRINT "[E]..Cancel" + cr$
RINPUT "Select protocol: ", tempchoice$
choice$ = upper(tempchoice$)
if len(choice$) = 1 then
IF choice$ = "E" THEN
EXIT
ENDIF
IF choice$ = "X" THEN
set protocol XMODEM
EXIT
ENDIF
IF choice$ = "C" THEN
set protocol XMODEMCRC
EXIT
ENDIF
IF choice$ = "Y" THEN
set protocol YMODEM
EXIT
ENDIF
IF choice$ = "Z" THEN
set protocol ZMODEM
EXIT
ENDIF
endif
if len(choice$) = 2 then
IF choice$ = "YB" THEN
set protocol YMODEMB
EXIT
ENDIF
IF choice$ = "YG" THEN
set protocol YMODEMG
EXIT
ENDIF
ENDIF
rprint cr2$+"Invalid Selection"+cr2$
WEND
IF choice$ = "E" THEN
rprint "Canceled!"+cr$
ELSE
ChangeDirectory(current_dir$)
RINPUT cr2$+"Enter Filename: ", transfer_file$
is_ok = DoesFileExist(transfer_file$)
IF is_ok = 1 THEN
RPRINT cr$+"File " + transfer_file$ + " was not found." + cr$
RPRINT "File transfer canceled!" + cr$
ELSE
RPRINT cr$+"Downloading " + transfer_file$ + cr$
ONERROR snderr
SEND transfer_file$
sleep 3
rprint cr$+"File Transfer Successful"
goto sndok
snderr:
rprint cr2$+"Error Downloading File"
rinput cr$+"Hit ENTER to Continue",temp$
sndok:
set error off
ENDIF
ENDIF
ENDIF
' Receive a File
IF command$ = "U" THEN
rprint cr4$
WHILE 1 = 1
IF Connected = 0 Then
EXIT
endif
RPRINT cr$+Header$+cr3$
RPRINT "Available Upload file transfer protocols:" + cr2$
RPRINT "[X]..XMODEM Checksum" + cr$
RPRINT "[C]..XMODEM CRC" + cr$
RPRINT "[Y]..YMODEM 1K" + cr$
RPRINT "[YB].YMODEM Batch" + cr$
RPRINT "[YG].YMODEM G" + cr$
RPRINT "[Z]..ZMODEM" + cr$
RPRINT "[E]..Exit" + cr$
RINPUT "Select protocol: ", tempchoice$
choice$ = upper(tempchoice$)
if len(choice$) = 1 then
IF choice$ = "E" THEN
EXIT
ENDIF
IF choice$ = "X" THEN
set protocol XMODEM
RINPUT cr$+"Enter Filename: ", transfer_file$
is_ok = ValidFileName(transfer_file$)
EXIT
ENDIF
IF choice$ = "C" THEN
set protocol XMODEMCRC
RINPUT cr$+"Enter Filename: ", transfer_file$
is_ok = ValidFileName(transfer_file$)
EXIT
ENDIF
IF choice$ = "Y" THEN
set protocol YMODEM
RINPUT cr$+"Enter Filename: ", transfer_file$
is_ok = ValidFileName(transfer_file$)
EXIT
ENDIF
IF choice$ = "Z" THEN
set protocol ZMODEM
transfer_file$ = ""
is_ok = 1
EXIT
ENDIF
ENDIF
if len(choice$) = 2 then
IF choice$ = "YB" THEN
set protocol YMODEMB
transfer_file$ = ""
is_ok = 1
EXIT
ENDIF
IF choice$ = "YG" THEN
set protocol YMODEMG
transfer_file$ = ""
is_ok = 1
EXIT
ENDIF
ENDIF
rprint cr2$+"Invalid Selection"+cr2$
WEND
IF choice$ = "E" THEN
rprint cr$+"Canceled"+cr$
ELSE
IF is_ok = 0 THEN
RPRINT "File " + transfer_file$ + " was not valid." + cr$
RPRINT "File transfer canceled!" + cr$
ELSE
ChangeDirectory(upload_dir$)
ONERROR rcverr
RPRINT "Uploading " + transfer_file$ +cr$
RPRINT cr$+"Start Your File Transfer"+cr$
RECEIVE transfer_file$
sleep 3
RPRINT cr$+"File Transfer Successful"+cr$
GOTO rcvok
rcverr:
Rprint "Error Uploading File - "+transfer_file$+cr$
rinput "Hit Enter to Continue",temp$
rcvok:
ChangeDirectory(current_dir$)
set error off
ENDIF
ENDIF
ENDIF
IF command$ = "S" THEN
RPRINT cr$+"Shutdown Initiated"
continue = 0
continue_commands = 0
ENDIF
' Change Directory
ENDIF
if len(command$) = 2 then
IF command$ = "CD" THEN
IF access_level > 1 THEN
RINPUT cr$+"Enter New Directory: ", new_dir$
is_ok = ChangeDirectory(new_dir$)
if is_ok = 0 then
current_dir$ = new_dir$
ELSE
RPRINT cr2$+"Unable to change to directory!"
ENDIF
ENDIF
ENDIF
IF command$ = "FS" Then
RPRINT cr2$+"Current File Specification is "+file_spec$+cr$
RINPUT cr$+"Enter New File Specification: ", file_spec$
IF LEN(file_spec$) = 0 THEN
file_spec$ = filespec
ENDIF
ENDIF
' Add a New User
IF command$ = "AU" THEN
IF access_level > 2 THEN
rprint cr4$
RPRINT cr$+Header$+cr$
RPRINT "Add a new user." + cr$
RINPUT cr$+"Enter new user's First name: ", new_first$
RINPUT cr$+"Enter new user's Last name: ", new_last$
RINPUT cr$+"Enter new user's Password: ", new_password$
RINPUT cr$+"Enter new user's Access level: ", new_level$
iLevel = val(new_level$)
is_ok = AddUser(new_first$, new_last$, new_password$, iLevel)
IF is_ok > 0 THEN
RPRINT cr$+"Unable to add user record!" + cr$
ELSE
RPRINT cr$+new_first$+" "+new_last$+" added to datafile." + cr$
ENDIF
ENDIF
ENDIF
' Change an Existing User
IF command$ = "CU" THEN
IF access_level > 2 THEN
rprint cr4$
RPRINT cr$+Header$+cr$
RPRINT "Change an existing user." + cr$
RINPUT cr$+"Enter user's First name: ", new_first$
RINPUT cr$+"Enter user's Last name: ", new_last$
RINPUT cr$+"Enter user's new Password or blank to skip: ", new_password$
RINPUT cr$+"Enter new Access Level: ", new_level$
iLevel = val(new_level$)
is_ok = ChangeUser(new_first$, new_last$, new_password$, iLevel)
IF is_ok > 0 THEN
RPRINT cr$+"Unable to change user record!" + cr$
ELSE
RPRINT cr$+new_first$+" "+new_last$+ " access level changed."+cr$
ENDIF
ENDIF
ENDIF
' Delete an Existing User
IF command$ = "DU" THEN
IF access_level > 2 THEN
rprint cr4$
RPRINT cr$+Header$+cr$
RPRINT "Delete an existing user." + cr$
RINPUT cr$+"Enter user's First name: ", new_first$
RINPUT cr$+"Enter user's Last name: ", new_last$
is_ok = DeleteUser(new_first$, new_last$)
IF is_ok > 0 THEN
RPRINT cr$+"Unable to delete user record!" + cr$
ELSE
RPRINT cr$+new_first$+" "+new_last$+" deleted." + cr$
ENDIF
ENDIF
ENDIF
ENDIF
WEND
force_hangup:
HANGUP
WEND
Mprint "Script Terminated"
END